﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;

namespace SkillEditor
{
    public class GraphSubWindow : GraphElement
    {
        public virtual string styleName => "GraphSubWindow";

        public Label label;

        public GraphSubWindow()
        {
            //var styleSheet = Resources.Load<StyleSheet>($"Styles/{styleName}");
            // Setup VisualElement from Stylesheet and UXML file
            //styleSheets.Add(styleSheet);
            style.position = Position.Absolute;
            style.borderLeftWidth = 1;
            style.borderTopWidth = 1;
            style.borderRightWidth = 1;
            style.borderBottomWidth = 1;
            style.borderBottomLeftRadius = 5;
            style.borderBottomRightRadius = 5;
            style.borderTopLeftRadius = 5;
            style.borderTopRightRadius = 5;
            style.flexDirection = FlexDirection.Column;
            style.minWidth = 100;
            style.minHeight = 100;
            style.width = 200;
            style.height = 200;
            style.backgroundColor = new Color(0.8274511f, 0.8274511f, 0.8274511f);

            SetPosition(new Rect(0f, 20f, 200f, 200f));
            label = new Label("C# Label");
            label.AddToClassList("some-styled-label");
            label.style.color = Color.black;
            label.style.whiteSpace = WhiteSpace.Normal;
            label.style.flexWrap = Wrap.Wrap;
            contentContainer.Add(label);
        }

        public void SetText(string v)
        {
            label.text = v;
        }
    }
}